<?php

use yii\db\Migration;

class m180610_152029_ad_wx extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%ad_wx}}', [
            'id' => 'int(11) NOT NULL AUTO_INCREMENT',
            'account' => 'varchar(255) NOT NULL DEFAULT \'\' COMMENT \'微信号\'',
            'qrcode' => 'varchar(255) NOT NULL DEFAULT \'\' COMMENT \'二维码\'',
            'append' => 'int(10) NOT NULL DEFAULT \'0\' COMMENT \'创建时间\'',
            'updated' => 'int(10) NULL DEFAULT \'0\' COMMENT \'修改时间\'',
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%ad_wx}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

